<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="text" indent="no"  />
	
		<xsl:template match="/">
&lt;cfcomponent displayname="<xsl:value-of select="//bean/@name"/>" output="false"&gt;
		<xsl:for-each select="root/bean/dbtable/column">&lt;cfproperty name="<xsl:value-of select="@name" />" type="<xsl:value-of select="@type" />" default="" /&gt;
		</xsl:for-each>
	&lt;!---
	PROPERTIES
	---&gt;
	&lt;cfset variables.hashmap = createObject("java", "java.util.HashMap").init() /&gt;

	&lt;!---
	INITIALIZATION / CONFIGURATION
	---&gt;
	&lt;cffunction name="init" access="public" returntype="any" output="false"&gt;
		&lt;cfargument name="inStruct" type="struct" default="#structNew()#" /&gt;
		&lt;cfscript&gt;
			var x = 0;
			var hmPropertyNames = structKeyList(inStruct);
			var propertyNames = "<xsl:for-each select="root/bean/dbtable/column"><xsl:value-of select="@name" />,</xsl:for-each>id";
			var propertyTypes = "<xsl:for-each select="root/bean/dbtable/column"><xsl:value-of select="@type" />,</xsl:for-each>numeric";
			if(NOT isStruct(arguments.inStruct)) {
				inHashmap = createObject("java", "java.util.HashMap").init();
			} else {
				inHashmap = createObject("java", "java.util.HashMap").init(arguments.inStruct);
			}
		  for(x = 1; x lte listLen(propertyNames); x = x+1) {
		  	propertyName = listGetAt(propertyNames,x);
		  	if(listFindNoCase(hmPropertyNames,propertyName) AND (isStruct(inHashmap[propertyName]) OR toString(inHashmap[propertyName]) gt "")) {
		  		variables.hashmap.put(propertyName,inHashmap[propertyName]);
		  	}	else {
		  	  if(listFindNoCase("string,date,numeric,boolean",listGetAt(propertyTypes,x))) {
			  		variables.hashmap.put(propertyName,"");
		  	  } else {
			  		variables.hashmap.put(propertyName,createObject("java","java.util.HashSet").init());
		  	  }
		  	}	  	
		  }
		&lt;/cfscript&gt;

		&lt;cfreturn variables.hashmap /&gt;
 	&lt;/cffunction&gt;


&lt;/cfcomponent&gt;</xsl:template>
</xsl:stylesheet>